home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 476-500 / disk_500 / wiconify / wutilities.lzh / wIcon.h < prev    next >
C/C++ Source or Header  |  1991-04-19  |  8KB  |  181 lines

  1. /*
  2.  *  WICONIFY    A utility that allows you to iconify any Intuition window
  3.  *              on any screen, and to open WB windows on any screen.
  4.  *
  5.  *  wIcon.h     Main user-level structures for programmer's interface.
  6.  *
  7.  *  Copyright 1990 by Davide P. Cervone, all rights reserved.
  8.  *  You may use this code, provided this copyright notice is kept intact.
  9.  */
  10.  
  11. #include <exec/ports.h>
  12.  
  13. /*
  14.  *  The name of the communication port used by wIcoinfy
  15.  */
  16.  
  17. #define WICONPORT   "wIconify-Port"
  18.  
  19. /*
  20.  *  Makes dealing with flag bits easier
  21.  */
  22.  
  23. #ifndef BIT
  24. #define BIT(x)   (1<<(x))
  25. #endif
  26.  
  27. /*
  28.  *  define pointers for structures that may not be defined
  29.  */
  30.  
  31. #ifndef WICONREF
  32. #define WICONREF     APTR
  33. #endif
  34.  
  35. #ifndef WSCREEN
  36. #define WSCREEN      APTR
  37. #endif
  38.  
  39.  
  40. /*
  41.  *  The main wIcon definition structure.  This is what programs use
  42.  *  to declare the imagery and properties of an icon.  wIconify uses
  43.  *  the wIconRef structure internally, and copies data from the wIcon
  44.  *  definition into the wIconRef structure when an icon is created.
  45.  *  From them on, the user has a pointer to a wIconRef, not a wIcon.
  46.  */
  47.  
  48. struct wIcon
  49. {
  50.    char *Name;              /* the icon's Name */
  51.    struct Image *Image;     /* the icon's unselected Image (NULL = default) */
  52.    struct Image *Select;    /* the icon's Selected image (NULL = complement) */
  53.    UWORD *Mask;             /* the icon's selected image Mask (NULL = none) */
  54.    WORD x,y;                /* the icon's initial position */
  55.    ULONG Flags;
  56.       #define WI_NOICONIFY          BIT(0)  /* do not iconify this window */
  57.       #define WI_CHANGEREFRESH      BIT(1)  /* change refresh type for icon */
  58.       #define WI_ICONIFIED          BIT(2)  /* window is iconified */
  59.       #define WI_NOSAVEPOS          BIT(3)  /* don't save icon X,Y when open */
  60.       #define WI_AUTOREMOVE         BIT(9)  /* delete on screen close */
  61.       #define WI_LOCKED             BIT(20) /* never move move icon */
  62.       #define WI_NOORGANIZE         BIT(21) /* do not ORGANIZE icon */
  63.       #define WI_NOMOVE             BIT(22) /* do not allow icon to be moved */
  64.       #define WI_NOCLOSE            BIT(23) /* do not allow icon to be closed */
  65.       #define WI_NOMULTISELECT      BIT(24) /* can't select more than one */
  66.       #define WI_SELECTED           BIT(25) /* icon is currently selected */
  67. /*                                            (for future expansion)
  68.       #define WI_LTOP               BIT(26)
  69.       #define WI_LBOTTOM            BIT(27)
  70.       #define WI_RTOP               BIT(28)
  71.       #define WI_RBOTTOM            BIT(29)
  72.       #define WI_VERTICAL           BIT(30)
  73.       #define WI_HORIZONTAL         BIT(31)
  74. */
  75.    ULONG Report;                /* types of messages to report */
  76.       #define WI_REPORTAUTOREMOVE   BIT(19) /* icon was AUTOREMOVED */
  77.       #define WI_REPORTMOVED        BIT(20) /* icon has been moved */
  78.       #define WI_REPORTSELECT       BIT(21) /* icon has become selected */
  79.       #define WI_REPORTUNSELECT     BIT(22) /* icon has become unselected */
  80.       #define WI_REPORTPRESS        BIT(23) /* icon has been pressed */
  81.       #define WI_REPORTRELEASE      BIT(24) /* icon has been released */
  82.       #define WI_REPORTOPEN         BIT(25) /* icon is being opened */
  83.       #define WI_REPORTCLOSE        BIT(26) /* icon is being closed */
  84. /*    #define WI_REPORTDROP         BIT(27)*//* another icon dropped on icon */
  85.       #define WI_REPORTNEWSCREEN    BIT(28) /* a new screen was openned */
  86.       #define WI_REPORTSCREENCLOSE  BIT(29) /* a screen was closed */
  87.       #define WI_REPORTACTIVATE     BIT(30) /* wIconify window is active */
  88.       #define WI_REPORTINACTIVE     BIT(31) /* wIconify window is inactive */
  89.       #define WI_REPORTRESTORE      BIT(11) /* window is no longer iconified */
  90.       #define WI_REPORTICONVERIFY   BIT(10) /* don't iconify until OKed */
  91.       #define WI_REPORTICONEND      BIT(9)  /* wIconify is ending */
  92.       #define WI_REPORTICONIFIED    BIT(8)  /* window has become iconified */
  93.    struct MsgPort *IconPort;    /* port for wIconify messages */ 
  94. };
  95.  
  96. typedef struct wIcon WICON;
  97.  
  98.  
  99. /*
  100.  *  If the IconPort field of the wIcon structure is not NULL, it points to
  101.  *  a message port where wIconify will send messages when things happen
  102.  *  to the specified icon.  The Report field of the wIcon structure 
  103.  *  specifies what kind of messages are to be reported.  When an Icon event is
  104.  *  reported, the port will receive a wIconMessage as defined below.  The
  105.  *  Action field will contain one of the report flags as defined above, which
  106.  *  indicates what event occured.  When your program is done with the message
  107.  *  it should reply to the message as normal.  If the Action is 
  108.  *  WI_REPORTICONVERIFY, however, you should set or clear the WI_ICONIFYOK
  109.  *  flag in the Flags field of the wIconMessage depending on whether it is
  110.  *  OK to iconify the window or not.
  111.  *
  112.  *  The wIconMessage is also used by the wIconCalls library to contact
  113.  *  wIconify directly (to add and remove icons, move icons, etc).
  114.  *  The Actions defined below are for this purpose, and are not used by
  115.  *  the messages received by an IconPort.  User programs will not
  116.  *  usually specify these messages directly, but will use the wIconCalls
  117.  *  library to manager these messages.  The union at the bottom of
  118.  *  the structure is also for this purpose, and will not contain useful
  119.  *  data when a wIconMessage is received by an IconPort.
  120.  *
  121.  *  Note that many icons can share the same IconPort.
  122.  */
  123.  
  124. struct wIconMessage
  125. {
  126.    struct Message Message;          /* the Exec message structure */
  127.    struct Window *Window;           /* affected window */
  128.    WICONREF *Icon;                  /* the affected icon */
  129.    ULONG Action;                    /* what to do */
  130.      /* any of the WI_REPORT... flags above may also appear here */
  131.      #define WI_ICONIFY     1   /* window should be iconified */
  132.      #define WI_RESTORE     2   /* window should be restored */
  133.      #define WI_ICONOF      3   /* returns icon of given window */
  134.      #define WI_SETICON     4   /* associates an icon with a window */
  135.      #define WI_UNSETICON   5   /* unsets an icon from a window */
  136.      #define WI_SELECTICON  6   /* select a given icon */
  137.      #define WI_UNSELECT    7   /* unselect a given icon */
  138.      #define WI_MOVEICON    8   /* move an icon to a new position */
  139.      #define WI_ADDICON     9   /* add a new icon to a screen */
  140.      #define WI_REMOVEICON  10  /* remove an icon from a screen */
  141.      #define WI_REDRAW      11  /* screen needs refreshing */
  142.      #define WI_UPDATEICON  12  /* update icon imagery, etc. */
  143.      #define WI_BACKDROPOF  13  /* wIconify window of a given screen */
  144.  
  145.      #define WI_REMSCREEN   32  /* screen should be unlinked */
  146.      #define WI_CLOSEICON   33  /* icon should get a CLOSE message */
  147.      #define WI_SELECTNEXT  34  /* select next icon in the list */
  148.      #define WI_NEWSCREEN   35  /* create a new screen */
  149.      #define WI_MAKEWB      36  /* make a screen the WB screen */
  150.      #define WI_OPENSELECT  37  /* open all selected icons */
  151.      #define WI_CLOSESELECT 38  /* close all selected icons */
  152.      #define WI_OPENON      39  /* set OPEN WINDOW menus */
  153.  
  154.      #define WI_MAKECONTACT 64  /* initial library contact message */
  155.      #define WI_VERSIONOK   65  /*  versions are OK */
  156.      #define WI_VERSIONBAD  66  /*  versions don't match */
  157.      #define WI_ENDICONIFY  67  /* ask iconify to end */
  158.      #define WI_ENDOK       68  /*  end was OK */
  159.      #define WI_ENDFAILED   69  /*  end is pending screen closes */
  160.  
  161.    ULONG Flags;
  162.      #define WI_NOREPLY     BIT(31) /* wIconify should free this message */
  163.      #define WI_ADDTOSELECT BIT(30) /* for WI_SELECTICON */
  164.      #define WI_ICONMESSAGE BIT(29) /* wIconify originated this message */
  165.      #define WI_REPORT      BIT(28) /* This is a REPORT message */
  166.      #define WI_ICONIFYOK   BIT(1)  /* answer to WI_REPORTICONVERIFY */
  167.      #define WI_CHANGE      BIT(0)  /* window refresh bits should be changed */
  168.    union
  169.    {
  170.       struct Window *Window;
  171.       struct Screen *Screen;
  172.       WSCREEN *wScreen;
  173.       struct {WORD x,y;} Position;
  174.       struct {UWORD Depth,Modes;} NewScreen;
  175.       struct {UWORD Maj,Min;} Version;
  176.       struct {UWORD ScreenType,SizeToFit;} OpenOn;
  177.       WICON *Icon;
  178.       APTR DataPtr;
  179.    } Data;                          /* special data used by icon commands */
  180. };
  181.